package com.platform.hjt.sys.model;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Min;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.platform.hjt.sys.model.json.SysCompanyInfoSerialize;

/**
 * SysUserInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "sys_user_info")
public class SysUserInfo implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -5256495296952225210L;
	private String sysUserInfoId;
	private SysCompanyInfo sysCompanyInfo;
	private SysDept sysDept;
	@NotBlank(message="用户名称不能为空")
	@Length(max=100, message="名称长度不能超过100个字")
	private String userName;
	private String userPhone;
	private String userTelephone;
	private String userFax;
	private String userAddr;
	private String userEmail;
	private String userSex;
	@NotBlank(message="用户账号不能为空")
	@Length(max=100, message="名称长度不能超过100个字")
	private String userAccount;
	private String userPwd;
	private String userType;
	private String userIpLimit;
	private String state;
	@Min(value=0, message="序号必须是数字")
	private Integer sortIndex;
	private Timestamp createTime;
	private Boolean isDel;
	
	private String userCode;
	
	private String sysModelIds;

	// Constructors

	/** default constructor */
	public SysUserInfo() {
	}

	/** minimal constructor */
	public SysUserInfo(String sysUserInfoId) {
		this.sysUserInfoId = sysUserInfoId;
	}

	/** full constructor */
	public SysUserInfo(String sysUserInfoId, SysCompanyInfo sysCompanyInfo,
			SysDept sysDept, String userName, String userPhone,
			String userTelephone, String userFax, String userAddr,
			String userEmail, String userSex, String userAccount,
			String userPwd, String userType, String userIpLimit, String state,
			Integer sortIndex, Timestamp createTime, Boolean isDel) {
		this.sysUserInfoId = sysUserInfoId;
		this.sysCompanyInfo = sysCompanyInfo;
		this.sysDept = sysDept;
		this.userName = userName;
		this.userPhone = userPhone;
		this.userTelephone = userTelephone;
		this.userFax = userFax;
		this.userAddr = userAddr;
		this.userEmail = userEmail;
		this.userSex = userSex;
		this.userAccount = userAccount;
		this.userPwd = userPwd;
		this.userType = userType;
		this.userIpLimit = userIpLimit;
		this.state = state;
		this.sortIndex = sortIndex;
		this.createTime = createTime;
		this.isDel = isDel;
	}

	// Property accessors
	@Id
	@GenericGenerator(name="systemUUID",strategy="uuid")
	@GeneratedValue(generator="systemUUID")
	@Column(name = "sys_user_info_id", unique = true, nullable = false, length = 32)
	public String getSysUserInfoId() {
		return this.sysUserInfoId;
	}

	public void setSysUserInfoId(String sysUserInfoId) {
		this.sysUserInfoId = sysUserInfoId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "sys_company_info")
	@JsonSerialize(using = SysCompanyInfoSerialize.class)
	public SysCompanyInfo getSysCompanyInfo() {
		return this.sysCompanyInfo;
	}

	public void setSysCompanyInfo(SysCompanyInfo sysCompanyInfo) {
		this.sysCompanyInfo = sysCompanyInfo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "sys_dept_id")
	@JsonIgnore
	public SysDept getSysDept() {
		return this.sysDept;
	}

	public void setSysDept(SysDept sysDept) {
		this.sysDept = sysDept;
	}

	@Column(name = "user_name", length = 100)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "user_phone", length = 11)
	public String getUserPhone() {
		return this.userPhone;
	}

	public void setUserPhone(String userPhone) {
		this.userPhone = userPhone;
	}

	@Column(name = "user_telephone", length = 50)
	public String getUserTelephone() {
		return this.userTelephone;
	}

	public void setUserTelephone(String userTelephone) {
		this.userTelephone = userTelephone;
	}

	@Column(name = "user_fax", length = 50)
	public String getUserFax() {
		return this.userFax;
	}

	public void setUserFax(String userFax) {
		this.userFax = userFax;
	}

	@Column(name = "user_addr", length = 500)
	public String getUserAddr() {
		return this.userAddr;
	}

	public void setUserAddr(String userAddr) {
		this.userAddr = userAddr;
	}

	@Column(name = "user_email", length = 200)
	public String getUserEmail() {
		return this.userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	@Column(name = "user_sex", length = 1)
	public String getUserSex() {
		return this.userSex;
	}

	public void setUserSex(String userSex) {
		this.userSex = userSex;
	}

	@Column(name = "user_account", length = 100)
	public String getUserAccount() {
		return this.userAccount;
	}

	public void setUserAccount(String userAccount) {
		this.userAccount = userAccount;
	}

	@Column(name = "user_pwd", length = 100)
	public String getUserPwd() {
		return this.userPwd;
	}

	public void setUserPwd(String userPwd) {
		this.userPwd = userPwd;
	}

	@Column(name = "user_type", length = 1)
	public String getUserType() {
		return this.userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

	@Column(name = "user_ip_limit", length = 5000)
	public String getUserIpLimit() {
		return this.userIpLimit;
	}

	public void setUserIpLimit(String userIpLimit) {
		this.userIpLimit = userIpLimit;
	}

	@Column(name = "state", length = 1)
	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "sort_index")
	public Integer getSortIndex() {
		return this.sortIndex;
	}

	public void setSortIndex(Integer sortIndex) {
		this.sortIndex = sortIndex;
	}

	@Column(name = "create_time", length = 19)
	public Timestamp getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	@Column(name = "is_del")
	public Boolean getIsDel() {
		return this.isDel;
	}

	public void setIsDel(Boolean isDel) {
		this.isDel = isDel;
	}

	@Column(name = "user_code")
	public String getUserCode() {
		return userCode;
	}

	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}
	
	@Transient
	public String getSysModelIds() {
		return sysModelIds;
	}

	public void setSysModelIds(String sysModelIds) {
		this.sysModelIds = sysModelIds;
	}

}